<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>网站后台管理中心- Powered by UUASK</title>
<link rel="shortcut icon" href="/favicon.ico" />
<link href="/<?php echo C('UU_ADMINTPL_DIR');?>/public/css/common.css" rel="stylesheet" type="text/css">
<script src="/<?php echo C('UU_ADMINTPL_DIR');?>/public/js/jquery.min.js"></script>
<script src="/<?php echo C('UU_ADMINTPL_DIR');?>/public/js/jquery.highlight-3.js"></script>
<script src="/<?php echo C('UU_ADMINTPL_DIR');?>/public/js/jquery.vtip-min.js"></script>
<script src="/<?php echo C('UU_ADMINTPL_DIR');?>/public/js/jquery.dialog.js"></script>
<!--[if lt IE 9]>
  <script type="text/javascript" src="/<?php echo C('UU_ADMINTPL_DIR');?>/public/js/PIE.js"></script>
  <script type="text/javascript">
    (function($){
        $.pie = function(name, v){
            // 如果没有加载 PIE 则直接终止
            if (! PIE) return false;
            // 是否 jQuery 对象或者选择器名称
            var obj = typeof name == 'object' ? name : $(name);
            // 指定运行插件的 IE 浏览器版本
            var version = 9;
            // 未指定则默认使用 ie10 以下全兼容模式
            if (typeof v != 'number' && v < 9) {
                version = v;
            }
            // 可对指定的多个 jQuery 对象进行样式兼容
            if ($.browser.msie && obj.size() > 0) {
                if ($.browser.version*1 <= version*1) {
                    obj.each(function(){
                        PIE.attach(this);
                    });
                }
            }
        }
    })(jQuery);
    if ($.browser.msie) {
      $.pie('.pie_about');
    };
  </script>
<![endif]-->
<script src="/<?php echo C('UU_ADMINTPL_DIR');?>/public/js/jquery.disappear.tooltip.js"></script>
<script src="/<?php echo C('UU_ADMINTPL_DIR');?>/public/js/common.js"></script>
</head>
<body>
<div class="allpagetop">网站设置<strong>/</strong>问题分类</div>
<div class="admin_main_nr_dbox">
 	    <div class="pagetit">
	        <div class="ptit">问题分类</div>
				<div class="topnav">
			        
					  <a href="<?php echo RU('Category/cat_question',array('c_type'=>$c_type));?>" <?php if(ACTION_NAME == 'cat_question'): ?>class="select"<?php endif; ?>>列表</a>
					   <a href="<?php echo RU('Category/cat_question_add',array('c_type'=>$c_type));?>" <?php if(ACTION_NAME == 'cat_question_add'): ?>class="select"<?php endif; ?>>添加</a>
				    <div class="clear"></div>
				</div>
	        <div class="clear"></div>
	    </div>
		 <form id="form1" name="form1" method="post" action="<?php echo RU('Category/allSave');?>">
   <div class="admin_list_th">
	    <div class="td1" style=" width:60%;"><div class="left_txt_td">分类名称</div></div>
		<div class="td2" style=" width:20%;">排序</div>
		<div class="td3" style=" width:20%;"><div class="admin_list_right">操作</div></div>
	  <div class="clear"></div>
	  </div>
  
  <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$list): $mod = ($i % 2 );++$i;?><div class="admin_list_tr link_bk">
						<div class="td1" style=" width:60%;">
								  <div class="category_img J_show" pid="<?php echo ($list["c_id"]); ?>"></div>
								  <div class="category_input"><input name="c_id[]" type="hidden" value="<?php echo ($list["c_id"]); ?>" />
								<input name="c_title[]" type="text"  class="input_text_default small" maxlength="100" value="<?php echo ($list["c_title"]); ?>"/>
								  </div>
								  
								  <div class="category_pic">
									  <?php if($list["c_pic"] != '' ): ?><img src="/<?php echo C('UU_IMG_CATEGORY_DIR'); echo ($list["c_pic"]); ?>"  border="0" title="分类图标"/><?php endif; ?>
								  </div>
								  <div class="clear"></div>
						</div>
						<div class="td2" style=" width:20%;">
						<input name="c_sort[]" type="text"  class="input_text_default small" maxlength="100" value="<?php echo ($list["c_sort"]); ?>" style="width:50px;"/>
						</div>
						<div class="td3" style=" width:20%;">
									  <div class="admin_list_right link_blue">
									  <a href="<?php echo RU('Category/cat_question_add',array('c_id'=>$list['c_id'],'c_type'=>$c_type));?>">此类下加子类</a>
									  <a href="<?php echo RU('Category/cat_question_edit',array('c_id'=>$list['c_id']));?>">修改</a>
									  <a href="<?php echo RU('Category/delete',array('c_id'=>$list['c_id']));?>" onclick="return confirm('删除大类会同时删除其子类，你确定要删除吗？')">删除</a>
									  </div>
						</div>
					  <div class="clear"></div>
					  </div>
					  
	                   <div class="J_cat_show"></div><?php endforeach; endif; else: echo "" ;endif; ?>
  
  
  <div id="J_add_show_div"></div>
  
    <div class="admin_list_tr">
						<div class="td1" style=" width:60%;">
								<div class="category_list_add" id="J_category_add">添加分类</div>
						</div>	 
				 
					 	<div class="clear"></div>
	</div>


 

	
	
	
	<div class="admin_list_foot">
			  <div class="btnbox">
				<input name="提交" type="submit" class="admin_submit"  id="ButSave"  value="保存分类"/>
				<input type="button" class="admin_submit" id="ButADD"   value="添加" onclick="window.location='<?php echo RU('Category/cat_question_add',array('c_type'=>$c_type));?>'"/>
			  </div>			 
	</div>
	</form>
  
</div>
<div class="footer link_lan">
Powered by <a href="http://www.zgxmall.com" target="_blank"><span style="color:#009900">中港星企业服务</span><span style="color: #FF3300">论坛</span></a> <?php echo C('UU_VERSION');?>
</div>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){

function get_add_html()
{
	var html='';
	html+="<div class=\"admin_list_tr link_bk\">";
	html+="<div class=\"td1\" style=\" width:60%;\">";
	html+="<div class=\"category_img\"></div>";
	html+="<div class=\"category_input\"><input name=\"add_pid[]\" type=\"hidden\" value=\"0\"/><input name=\"add_type[]\" type=\"hidden\" value=\"<?php echo ($c_type); ?>\"/>";
	html+="<input name=\"add_title[]\" type=\"text\"  class=\"input_text_default small\" />";
	html+="</div>";
	html+="<div class=\"clear\"></div>";
	html+="</div>";
	html+="<div class=\"td2\" style=\" width:20%;\">";
	html+="<input name=\"c_sort[]\" type=\"text\"  class=\"input_text_default small\" value=\"0\" style=\"width:50px;\"/>";
	html+="</div>";
	html+="<div class=\"td3\" style=\" width:20%;\">";
	html+="</div>";
	html+="<div class=\"clear\"></div>";
	html+="</div>";
	return html;
}
//添加顶级分类
$("#J_category_add").live('click',function()
{
	html=get_add_html();
	$("#J_add_show_div").before(html);
});
//打开子菜单

$(".J_show").click( function () {
	 var infobox=$(this).parent().parent().next('.J_cat_show');
      if (infobox.html()=='')//第一次加载并且显示
      {
	  	pid=$(this).attr('pid');
		get_json_content(infobox,pid);
		$(this).toggleClass('show');
      }
      else
      {
	  infobox.toggle();
	  $(this).toggleClass('show'); 
      }
 });
 
function get_json_content(infobox,pid)
{
	 	html="";
		$.getJSON("<?php echo RU('Category/cat_question');?>", { c_pid:pid}, function(data){
		  $.each(data.content, function(i, item) {
		  	html+="<div class=\"admin_list_tr link_bk\">";
			html+="<div class=\"td1\" style=\" width:60%;\">";
			html+="<div class=\"category_sub_img\">&nbsp;</div>";
			html+="<div class=\"category_input\"><input name=\"c_id[]\" type=\"hidden\"  value=\"" + item.c_id + "\"/>";
			html+="<input name=\"c_title[]\" type=\"text\"  class=\"input_text_default small\" value=\"" + item.c_title + "\"/>";
			html+="</div>";
			html+="<div class=\"clear\"></div>";
			html+="</div>";
			html+="<div class=\"td2\" style=\" width:20%;\">";
			html+="<input name=\"c_sort[]\" type=\"text\"  class=\"input_text_default small\" value=\"" + item.c_sort + "\" style=\"width:50px;\"/>";
			html+="</div>";
			html+="<div class=\"td3\" style=\" width:20%;\">";
			html+="<div class=\"admin_list_right link_blue\">";
			//html+="<a href=\""+ item.addurl +"\">此类下加子类</a>";
			html+="<a href=\""+ item.editurl +"\">修改</a>";
			html+="<a href=\""+ item.deleteurl +"\" onclick=\"return confirm('删除大类会同时删除其子类，你确定要删除吗？')\">删除</a>";
			html+="</div>";
			html+="</div>";
			html+="<div class=\"clear\"></div>";
			html+="</div>";
        });
		infobox.html(html);
		infobox.find(".category_sub_img").last().addClass('last');
		
	});
}

 
});
</script>
</body>
</html>